package activity;

import com.qzhy.female.R;

import Constant.Constance;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

public class UpdateNickNameActivity extends ActionBarActivity implements OnClickListener {

	private ImageView mImgBack;
	private EditText mEtNickName;
	private TextView mTvComfirm;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_update_nick_name);
		InitUI();
	}

	private void InitUI() {
		mImgBack = (ImageView) findViewById(R.id.img_back);
		mImgBack.setOnClickListener(this);
		mEtNickName = (EditText) findViewById(R.id.et_nickname);
		
		mTvComfirm = (TextView) findViewById(R.id.tv_comfrim);
		mTvComfirm.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.img_back:
			finish();
			break;
		case R.id.tv_comfrim:
			CofirmNickName();
			break;
		default:
			break;
		}
	}

	private void CofirmNickName() {
		Intent date = new Intent();
		date.putExtra("NickName", mEtNickName.getText().toString().trim());
		setResult(Constance.INTENT.COMFIRM_NICKNAME, date);
		finish();
	}
}
